package com.nowcoder.community.b_dao;

import com.nowcoder.community.a_entity.DiscussPost;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface DiscussPostMapper {

    //userid无时是查所有-分页用，userid有时是查一个人帖子后期用
    List<DiscussPost> selectDiscussPosts(@Param("userId")int userId,
                                         @Param("offset")int offset,
                                         @Param("limit")int limit,
                                         @Param("orderMode")int orderMode);

    //这个userid发了几条题解，后期用
    int selectDiscussPostRows(@Param("userId")int userId);


    DiscussPost selectDiscussPostById(@Param("id") int id);

    void insertDiscussPost(DiscussPost post);

    void updataCommentCount(@Param("id")int id, @Param("commentCount")int commentCount);


    int updateType(@Param("id")int id, @Param("type")int type);

    int updateStatus(@Param("id")int id, @Param("status")int status);

    int updateScore(@Param("id")int id, @Param("score")double score);

}
